
class Tecc{    //这个在main5
    public   void hello(){
        System.out.println("hello");
    }
}
class Student{
    public  String name;
    public  int num;
    public static int size;

//非静态代码块/实列化代码块
    {
        System.out.println("非静态代码块");
    }

    static{
        System.out.println("静态代码块");
    }
    public Student(){
        System.out.println("调用无参的构造函数");
    }

    public static void func(){
        System.out.println("abcd");
        System.out.println(1234);
    }
    public String toString(){      //这个对于main4，体现了 System.out.println(s1);，会调用这个函数
        return "NiuYuliang is cool";
    }
}

public class Text {
    public static void main5(String[] args) {
        Tecc test=null;
        test.hello();
    }
    public static void main4(String[] args) {

        Student s1=new Student();
        System.out.println(s1);   //
    }
    public static void main3(String[] args) {  //这个说明静态的代码块只会被执行一次
        Student s1=new Student();
        System.out.println("===============");
        Student s2=new Student();

    }
    public static void main(String[] args) {
        Student.func();  //只要类被加载，静态代码块就会被执行
    }
    public static void main1(String[] args) {

        Student s1=new Student();

    }
}
